package cn.broadsense.thrid.param;

import cn.broadsense.common.exception.ServiceException;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 支持关联点位批量 绑定或解绑
 *
 * @author pengxin
 * @date 2022-10-10 17:30
 */
@NoArgsConstructor
@Data
public class SysBindChannelParam extends BaseParam {
    private static final long serialVersionUID = -9131063339638119776L;
    /**
     * 必填，绑定操作类型，0-用户解绑；1-用户绑定
     */
    private Integer updateBind;
    /**
     * 必填，抓图网关id
     */
    private String capGatewayId;
    /**
     * 必填，操作通道数组
     */
    private List<String> relatedChannelList;


    @Override
    public void checkParam() {
        if (updateBind == null) {
            throw new ServiceException("绑定类型不能为空");
        }
        if (StrUtil.isBlank(capGatewayId)) {
            throw new ServiceException("抓图网关id不能为空");
        }
        if (CollUtil.isEmpty(relatedChannelList)) {
            throw new ServiceException("操作通道列表不能为空");
        }

    }

    @Override
    public Class getResultClass() {
        return String.class;
    }
}
